	<?php
		include_once("adb.php");
		
		
		class community_members2 extends adb{
			function community_members(){
				adb::adb();
			}
			/**
			*query all vaccines in the table and store the dataset in $this->result	
			*@return if successful true else false
			*/
			
			function get_community_members(){			
				$query="select community_member_id, card_number, fullname, gender,registration_date from community_members";
			}
				
				function get_all_community_members(){
			
				$query="select community_member_id, card_number, fullname, age, birthdate, gender, household_id, community_id, registration_date, up_datedate, device_id from community_members ";
				return $this->query($query);
			}
			  
			function get_a_community_member($community_member_id){
			
			$query="select community_member_id, card_number, fullname, age, birthdate, gender, household_id, community_id, registration_date, up_datedate, device_id from community_members where community_member_id=$community_member_id";
				return $this->query($query);
		
			}
		  
			  
			function add_community_member($community_member_id,$card_number){
				//write the SQL query and call $this->query()
				$gender="";
				$fullname="";
				$household_id="";
				$registration="";
				$birthdate="";
				$query="INSERT INTO  community_members(fullname,gender,card_number,community_member_id,household_id,registration_date,birthdate) VALUES
				('$_POST[fullname]','$_POST[gender]','$_POST[card_number]','$_POST[community_member_id]','$_POST[household_id]','$_POST[registration_date]','$_POST[birthdate]')";
			return $this->query($query);
			}
			/**
			*updates the record identified by id 
			*/
			function update_community_members($community_member_id,$card_number,$fullname, $age, $birthdate,$gender, $household_id, $community_id, $registration_date, $up_datedate, $device_id){
				$query ="UPDATE community_members SET card_number= '$card_number', fullname='$fullname', age='$age', birthdate='$birthdate', gender='$gender',registration_date='$registration_date', up_datedate='$up_datedate'  WHERE community_member_id =$community_member_id";
		
			return $this->query($query);
			}
		
				
			function searchMem($name){
			$query = "select * from community_members where fullname like '%$name%'";
			return $this->query($query);
			
			}
				//$query="update vaccines set vaccine_name='$vaccine_name',schedule=$schedule,url='$url' where vaccine_id=$vid";
				//write the SQL query and call $this->query()
		
			function delete_community_member($community_member_id){
			$query="DELETE FROM community_members WHERE community_member_id = $community_member_id";
			return $this->query($query);
			}
		}
	?>
